
import BaseView from "./baseView.js";

export default class denglu extends BaseView {
    //添加css样式
    renderCss() {
        $("head").append('<link rel="stylesheet" type="text/css" href="css/denglu.css"><link rel="stylesheet" type="text/css" href="css/reset.css">')
    }
    //渲染框架结构
    render() {
        this.$el.html(`
        <!-- 头部 -->
        <header class="header">
            <a href="./index-pc-shouye.html"><img src="./img/logo_s.png" alt="猫眼电影"></a>
        </header>
        <!-- 内容区域 -->
        <article class="layout">
            <img src="./img/login.png" alt="猫眼电影">
            <form action="">
                <p  class="layout"><label for="Identification">账号登录</label><label for="erweima"><span class="u1">二维码登录</span></label></p>
                <input type="text" placeholder="手机号/用户名/邮箱" id="Identification">
                <input type="password" placeholder="密码" id="pwd">
                <p class="layout">
                    <span class="jingxi"><input type="checkbox">7天内自动登录<i></i></span>
                    <a href="">忘记密码？</a>
                </p>
                <input type="button" value="登录" id="go">
                <p>还没有账号？<a href="javascript:;" id="register">免费注册</a></p>
            </form>
    
            <input type="radio" id="erweima">
           <div class="erweima1">
               <p>请扫二维码登录</p>
               <img src="./img/show.png" alt="">
           </div>
        </article>
        <footer>
            <p>©2021 美团网团购 meituan.com 京ICP证070791号 京公网安备11010502025545号</p>
        </footer>
        <script src="./lib/jquery.min.js"></script>
        <script src="./lib/director.min.js"></script>
        <script type="module" src="./routes/manyanRoutes.js"></script>   
        `)
    }
    handle(){
        $("#go").on("click",function(){
             $.ajax({
                type: "post",
                url:"/api/login",
                data:{
                    userName:$("#Identification").val(),
                    userPassword:$("#pwd").val()
                },
                dataType: "json",
                success(data){
                    if(data.code===0){
                        alert(data.msg);
                        window.location.hash =  '#/homepages'
                    }else{
                        alert(data.msg);
                    }
                    
                }
             })
        })
        $("#register").on("click",function(){
            window.location.hash =  '#/registers'
       })
    }
}
